<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增流程人员配置')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-config-add">
            <div class="form-group">    
                <label class="col-sm-2 control-label">编号：</label>
                <div class="col-sm-4">
                    <input name="code" class="form-control" type="text">
                </div>
                <label class="col-sm-2 control-label">名称：</label>
                <div class="col-sm-4">
                    <input name="name" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">流程类型：</label>
                <div class="col-sm-4">
                    <select name="processType" class="form-control" th:with="type=${@dict.getType('process_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
                <label class="col-sm-2 control-label">部门名称：</label>
                <div class="col-sm-4">
                	<select name="deptId" class="form-control" >
						<option th:each="dept:${deptlis}" th:value="${dept.deptId}" th:text="${dept.deptName}"></option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">公司名称：</label>
                <div class="col-sm-10">
                    <select name="comId" class="form-control" th:with="type=${@dict.getType('sj_gongs')}">
                    	<option value=""></option>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">  
                <label class="col-sm-2 control-label">level1name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input id="level1name" name="level1name" class="form-control" type="hidden">
                    	<input id="level1id" name="level1id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel1()" id="level1Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label">level2name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level2name" id="level2name" class="form-control" type="hidden">
                    	<input name="level2id" id="level2id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel2()" id="level2Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">level3name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level3name" id="level3name" class="form-control" type="hidden">
                    	<input name="level3id" id="level3id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel3()" id="level3Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label">level4name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level4name" id="level4name" class="form-control" type="hidden">
                    	<input name="level4id" id="level4id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel4()" id="level4Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">level5name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level5name" id="level5name" class="form-control" type="hidden">
                    	<input name="level5id" id="level5id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel5()" id="level5Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label">level6name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level6name" id="level6name" class="form-control" type="hidden">
                    	<input name="level6id" id="level6id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel6()" id="level6Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">level7name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level7name" id="level7name" class="form-control" type="hidden">
                    	<input name="level7id" id="level7id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel7()" id="level7Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label">level8name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level8name" id="level8name" class="form-control" type="hidden">
                    	<input name="level8id" id="level8id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel8()" id="level8Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">level9name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level9name" id="level9name" class="form-control" type="hidden">
                    	<input name="level9id" id="level9id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel9()" id="level9Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
                <label class="col-sm-2 control-label">level10name：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="level10name" id="level10name" class="form-control" type="hidden">
                    	<input name="level10id" id="level10id" class="form-control" type="hidden">
                    	<input class="form-control" type="text" onclick="selectlevel10()" id="level10Str" readonly="true" >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">描述：</label>
                <div class="col-sm-10">
                    <textarea name="descs" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "sj/config"
        $("#form-config-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-config-add').serialize());
            }
        }
        
      	//选择用户level1
		function selectlevel1() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel1User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel1User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level1id").val(rows[0].userId);
            $("#level1name").val(rows[0].userName);
            $("#level1Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level2
		function selectlevel2() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel2User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel2User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level2id").val(rows[0].userId);
            $("#level2name").val(rows[0].userName);
            $("#level2Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level3
		function selectlevel3() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel3User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel3User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level3id").val(rows[0].userId);
            $("#level3name").val(rows[0].userName);
            $("#level3Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level4
		function selectlevel4() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel4User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel4User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level4id").val(rows[0].userId);
            $("#level4name").val(rows[0].userName);
            $("#level4Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level5
		function selectlevel5() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel5User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel5User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level5id").val(rows[0].userId);
            $("#level5name").val(rows[0].userName);
            $("#level5Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level6
		function selectlevel6() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel6User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel6User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level6id").val(rows[0].userId);
            $("#level6name").val(rows[0].userName);
            $("#level6Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level7
		function selectlevel7() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel7User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel7User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level7id").val(rows[0].userId);
            $("#level7name").val(rows[0].userName);
            $("#level7Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level8
		function selectlevel8() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel8User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel8User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level8id").val(rows[0].userId);
            $("#level8name").val(rows[0].userName);
            $("#level8Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level9
		function selectlevel9() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel9User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel9User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level9id").val(rows[0].userId);
            $("#level9name").val(rows[0].userName);
            $("#level9Str").val(rows[0].userName);
            $.modal.closeAll();
        }
		
		//选择用户level10
		function selectlevel10() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       width: '1000',
		       height: '670',
		       callBack: doSubmitlevel10User
		    };
		    $.modal.openOptions(options);
		}
	 	
		function doSubmitlevel10User(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请选择一条记录！");
                return;
            }
            
            if (rows.length > 1) {
                $.modal.alertWarning("请勿选择多条记录！");
                return;
            }
            
            $("#level10id").val(rows[0].userId);
            $("#level10name").val(rows[0].userName);
            $("#level10Str").val(rows[0].userName);
            $.modal.closeAll();
        }
    </script>
</body>
</html>